//
//  Modify.m
//  MUBATE
//
//  Created by sunbin on 2017/2/18.
//  Copyright © 2017年 Quanli. All rights reserved.
//

#import "Modify.h"
#import "EnterPwd.h"

@interface Modify ()
@property (weak, nonatomic) IBOutlet UILabel  *account;
@property (weak, nonatomic) IBOutlet UILabel  *alertTitle;
@property (weak, nonatomic) IBOutlet UIButton *confirmBtn;
@property (weak, nonatomic) IBOutlet UIImageView *log;

@end

@implementation Modify
{
    modifyTy ty;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self initView];
}

- (void)initView{
    
    self.row = 1;
    BOOL isBingPhone  = ![NHUtils isBlankString:self.userInfor.store_phone];
    BOOL isBingEmaill = ![NHUtils isBlankString:self.userInfor.store_email];

    NSString *accountStr , *alertTitleStr , *btnTitle ;
    switch (self.bingAccountType) {
        case editPhone:{
        accountStr = isBingPhone?
            self.userInfor.store_phone:
            LocalizedString(@"You haven't binding mobile phone number");
        alertTitleStr = isBingPhone?
            LocalizedString(@"Change a phone number, the old phone number fails, available phone number to log in"):
            LocalizedString(@"After successful binding mobile phone, can be applied directly to the account login, share fun get joy");
            btnTitle = isBingPhone?
            LocalizedString(@"Change a phone number"):
            LocalizedString(@"Binding mobile phone number");
            ty = isBingPhone?Change_phoneNum:Binding_phone;
            
        }

            break;
        case editemail:{
            accountStr = isBingEmaill?
            self.userInfor.store_email:
            LocalizedString(@"You haven't binding mailbox");
            alertTitleStr = isBingEmaill?
            LocalizedString(@"Replace the mailbox, old email failure, available new E-mail number to log in"):
            LocalizedString(@"After successful binding mailbox, can be applied directly to the account login, share for joy");
            btnTitle = isBingPhone?LocalizedString(@"Change the email"):LocalizedString(@"Binding mailbox");
            ty = isBingPhone?Change_emaillNum:Binding_emaill;
            
        }
            break;
        default:
            break;
    }
    self.title = btnTitle;
    self.account.text = accountStr; self.alertTitle.text = alertTitleStr;
    [self.confirmBtn setTitle:btnTitle forState:UIControlStateNormal];
    
    NSString *imageName = self.bingAccountType==bingPhone?@"phone":@"emaill";
    self.log.image = Icon(imageName);
}

- (IBAction)btnEven:(UIButton *)sender {
    EnterPwd *enterPwd = kVCFromSb(@"EnterPwdID"             , @"CorporateCenter");
    enterPwd.bingAccountType = self.bingAccountType;
    enterPwd.modifyMake = ty;
    [self.navigationController pushViewController:enterPwd animated:NO];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
@end
